"""
Django的命令行工具，用于执行管理任务。该函数设置环境变量'DJANGO_SETTINGS_MODULE'为'settings.base'，
然后尝试从django.core.management导入execute_from_command_line函数。如果导入失败，会抛出ImportError异常。
最后，使用sys.argv作为参数执行execute_from_command_line函数。

Raises:
ImportError: 如果无法导入Django或者在虚拟环境中未激活Django，将抛出此异常。
"""

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.base')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()
